function YoutubeWebView() {
	var self = Ti.UI.createView();
	
	var back = Titanium.UI.createButton({
		title: 'Back',
	    style: Titanium.UI.iPhone.SystemButtonStyle.DONE
	});
	
	var title = Titanium.UI.createLabel({
		text: 'Search YouTube',
		color: '#fff',
		font: { fontWeight: 'bold', fontSize: 18 }
	});
	
	var flexSpace = Titanium.UI.createButton({
	    systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
	});
	
	var toolbar = Titanium.UI.iOS.createToolbar({
	    items:[back, flexSpace, title, flexSpace],
	    top:0,
	    borderTop:true,
	    borderBottom:false,
	    barColor: '#000'
	});
	
	self.add(toolbar);
	
	back.addEventListener("click", function(e) {
		self.fireEvent("youtubeWindowClosed", {});
	});
	
	var webview = Titanium.UI.createWebView({
		backgroundColor : '#0000',
		top: 44
	});

	self.add(webview);
	
	self.searchYoutube = function(data) {
		webview.url = "http://www.youtube.com/results?search_query=" + data.url;
	};

	return self;
};

module.exports = YoutubeWebView;
